#!/usr/bin/env bash

## configure and install minimal openbox desktop environment

## check for sudo/root
#if ! [ $(id -u) = 0 ]; then
#  echo "This script must run with sudo, try again..."
#  exit 1
#fi
cat ./xsessionrc >> /home/$SUDO_USER/.xsessionrc
chown $SUDO_USER:$SUDO_USER /home/$SUDO_USER/.xsessionrc

apt update
    apt install --no-install-recommends -y \
    xorg \
    mesa-vulkan-drivers \
    xserver-xorg-input-synaptics \
    xfonts-cyrillic \
    mesa-utils \
    xinput \
    xinit  

apt-get update
apt-get upgrade

apt-get install -y \
  openbox \
  lxappearance \
  lxappearance-obconf \
  obconf \
  obconf-qt \
  openbox-menu \
  compton \
  nitrogen \
  viewnior \
  dunst \
  elinks \
  xxkb \
  feh \
  mousepad \
  qt5ct \
  adwaita-qt \
  qt5-style-plugins \
  ntfs-3g \
  screenfetch \
  arandr \
  pavucontrol \
  udisks2 \
  udiskie \
  policykit-1-gnome \
  gvfs \
  alsamixergui \
  pavucontrol \
  curl \
  youtube-dl \
  gufw \
  gparted \
  ffmpeg \
  xsettingsd \
  keepassxc \
  bash-completion \
  alttab \
  redshift \
  mediainfo \
  gnome-terminal \
  plymouth-label 

apt-get install --no-install-recommends \
qmmp \
xfonts-terminus \
simplescreenrecorder \
mat2 \
mc \
gpick \
screenfetch \
rxvt-unicode \
zathura \
flameshot \
plank \
mpv \
gnome-mpv \
fbreader \
sakura \
libreoffice \
libreoffice-l10n-ru \
vlc \
smplayer \
smplayer-themes \
viewnior \
rofi \
file-roller \
unzip \
zip \
arj \
lzip \
lzop \
ncompress \
rzip \
squashfs-tools \
unace \
unalz \
unar \
lrzip \
p7zip \
p7zip-full \
network-manager \
xfce4-power-manager 

echo "exec openbox-session" >> ~/.xinitrc


mkdir -p .config/openbox
cp /etc/xdg/openbox/* ~/.config/openbox/
ls -a .config/openbox/
cp /etc/skel/ .xinitrc ~/.xinitrc

echo 
echo openbox install complete, please reboot and issue 'startx'
echo